package models

import (
	"github.com/goravel/framework/database/orm"
	"time"
)

type Admin struct {
	orm.Model
	orm.SoftDeletes
	Username  string    `gorm:"type:varchar(100);unique_index" json:"username"`
	Password  string    `gorm:"type:varchar(255)" json:"-"`
	Status    uint8     `gorm:"type:tinyint(1);default:1" json:"status"`
	LoginIp   string    `gorm:"type:varchar(255)" json:"login_ip"`
	LoginTime time.Time `gorm:"type:datetime" json:"login_time"`
	Roles     []Role    `gorm:"many2many:go_role_admin; joinForeignKey:admin_id;joinReferences:role_id" json:"roles"`
}

func (receiver *Admin) TableName() string {
	return "go_admin"
}
